polymorphication
authorØyvind Kolås <ok@src.gnome.org>
Tue, 16 Aug 2005 14:22:20 +0000 (14:22 +0000)
committerØyvind Kolås <ok@src.gnome.org>
Tue, 16 Aug 2005 14:22:20 +0000 (14:22 +0000)
29 files changed:
ChangeLog
babl/babl-component.c
babl/babl-component.h
babl/babl-conversion.c
babl/babl-conversion.h
babl/babl-fish.c
babl/babl-fish.h
babl/babl-format.c
babl/babl-format.h
babl/babl-image.c
babl/babl-image.h
babl/babl-instance.h
babl/babl-internal.h
babl/babl-introspect.c
babl/babl-model.c
babl/babl-model.h
babl/babl-pixel-format.c
babl/babl-pixel-format.h
babl/babl-sampling.c
babl/babl-sampling.h
babl/babl-sanity.c
babl/babl-type.c
babl/babl-type.h
tests/float_to_u8.c
tests/grayscale_to_rgb.c
tests/rgb_to_lab_to_rgb.c
tests/rgb_to_ycbcr.c
tests/rgb_to_ycbcr_to_rgb.c
tests/u8_to_float.c

index 9263c3accb2fa3cff7134b07f8b829560a695c9e..986fc0f1d9b83aac354182e71de9f89096b5cf54 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2005-08-16  Øyvind Kolås  <pippin@gimp.org>
+
+       * babl/babl-component.[ch]
+       * babl/babl-conversion.[ch]
+       * babl/babl-fish.[ch]
+       * babl/babl-image.[ch]
+       * babl/babl-instance.h
+       * babl/babl-internal.h
+       * babl/babl-introspect.c
+       * babl/babl-model.[ch] 
+       * babl/babl-pixel-format.[ch]
+       * babl/babl-sampling.[ch] 
+       * babl/babl-sanity.c 
+       * babl/babl-type.[ch] 
+       * tests/float_to_u8.c 
+       * tests/grayscale_to_rgb.c
+       * tests/rgb_to_lab_to_rgb.c
+       * tests/rgb_to_ycbcr.c
+       * tests/rgb_to_ycbcr_to_rgb.c
+       * tests/u8_to_float.c: Changed to use polymorph Babl * union's instead
+       of class specific structs in most cases, and in all cases for the
+       public API.
+
 2005-08-16  Øyvind Kolås  <pippin@gimp.org>
        
        * AUTHORS: Fixed spelling of Sven Neumann.
index a591f8e698dd5d38e7f0a0f3ca2c76b743cd9ea8..4f5d6939647a57f9c934b50cd466e4f5f472b248 100644 (file)
@@ -35,37 +35,37 @@ each_babl_component_destroy (Babl *babl,
   return 0;  /* continue iterating */
 }
 
-static BablComponent *
+static Babl *
 component_new (const char *name,
                int         id,
                int         luma,
                int         chroma,
                int         alpha)
 {
-  Babl *self;
+  Babl *babl;
 
-  self                   = babl_calloc (sizeof (BablComponent), 1);
-  self->class_type       = BABL_COMPONENT;
-  self->instance.id      = id;
-  self->instance.name    = babl_strdup (name);
-  self->component.luma   = luma;
-  self->component.chroma = chroma;
-  self->component.alpha  = alpha;
+  babl                   = babl_calloc (sizeof (BablComponent), 1);
+  babl->class_type       = BABL_COMPONENT;
+  babl->instance.id      = id;
+  babl->instance.name    = babl_strdup (name);
+  babl->component.luma   = luma;
+  babl->component.chroma = chroma;
+  babl->component.alpha  = alpha;
 
-  return (BablComponent*) self;
+  return babl;
 }
 
-BablComponent *
+Babl *
 babl_component_new (const char *name,
                     ...)
 {
   va_list varg;
-  BablComponent *self;
-  int            id         = 0;
-  int            luma    = 0;
-  int            chroma  = 0;
-  int            alpha   = 0;
-  const char    *arg=name;
+  Babl       *babl;
+  int         id         = 0;
+  int         luma    = 0;
+  int         chroma  = 0;
+  int         alpha   = 0;
+  const char *arg=name;
 
   va_start (varg, name);
   
@@ -136,17 +136,17 @@ babl_component_new (const char *name,
     
   va_end   (varg);
 
-  self = component_new (name, id, luma, chroma, alpha);
+  babl = component_new (name, id, luma, chroma, alpha);
 
-  if ((BablComponent*) db_insert ((Babl*)self) == self)
+  if (db_insert (babl) == babl)
     {
-      return self;
+      return babl;
     }
   else
     {
-      each_babl_component_destroy ((Babl*)self, NULL);
+      each_babl_component_destroy (babl, NULL);
       return NULL;
     }
 }
 
-BABL_CLASS_TEMPLATE(BablComponent, babl_component, "BablComponent")
+BABL_CLASS_TEMPLATE (babl_component)
index 17a1ee06fe958fbe4de03569c459a90cbbf03f77..dc7c26afa0d11103a631142e302ffa72f8ba776f 100644 (file)
@@ -21,6 +21,6 @@
 #define _BABL_COMPONENT_H
 
 #include "babl-classes.h"
-BABL_DEFINE_CLASS(BablComponent, babl_component)
+BABL_DEFINE_CLASS (babl_component)
 
 #endif
index f2385ff4486a4b9241dd4500baf31a69597bdefc..9aa7f8702f5585d1fddc7a0672c033f70c83a794 100644 (file)
@@ -32,7 +32,7 @@ each_babl_conversion_destroy (Babl *babl,
   return 0;  /* continue iterating */
 }
 
-static BablConversion *
+static Babl *
 conversion_new (const char        *name,
                 int                id,
                 Babl              *source,
@@ -43,7 +43,7 @@ conversion_new (const char        *name,
                 BablFuncPlanar     planar,
                 BablFuncPlanarBit  planar_bit)
 {
-  Babl *self = NULL;
+  Babl *babl = NULL;
 
   /* destination is of same type as source */ 
   switch (source->class_type)
@@ -51,15 +51,15 @@ conversion_new (const char        *name,
       case BABL_TYPE:
         if (linear)
           {
-            self = babl_calloc (sizeof (BablConversionType), 1);
-            self->class_type      = BABL_CONVERSION_TYPE;
-            self->conversion.function.linear = linear;
+            babl = babl_calloc (sizeof (BablConversionType), 1);
+            babl->class_type      = BABL_CONVERSION_TYPE;
+            babl->conversion.function.linear = linear;
           }
         else if (planar)
           {
-            self = babl_calloc (sizeof (BablConversionTypePlanar), 1);
-            self->class_type = BABL_CONVERSION_TYPE_PLANAR;
-            self->conversion.function.planar = planar;
+            babl = babl_calloc (sizeof (BablConversionTypePlanar), 1);
+            babl->class_type = BABL_CONVERSION_TYPE_PLANAR;
+            babl->conversion.function.planar = planar;
           }
         else if (planar_bit)
           {
@@ -83,9 +83,9 @@ conversion_new (const char        *name,
           }
         else if (planar)
           {
-            self = babl_calloc (sizeof (BablConversionModelPlanar), 1);
-            self->class_type = BABL_CONVERSION_MODEL_PLANAR;
-            self->conversion.function.planar = planar;
+            babl = babl_calloc (sizeof (BablConversionModelPlanar), 1);
+            babl->class_type = BABL_CONVERSION_MODEL_PLANAR;
+            babl->conversion.function.planar = planar;
           }
         else if (planar_bit)
           {
@@ -97,15 +97,15 @@ conversion_new (const char        *name,
       case BABL_PIXEL_FORMAT:
         if (linear)
           {
-            self = babl_calloc (sizeof (BablConversionPixelFormat), 1);
-            self->class_type = BABL_CONVERSION_PIXEL_FORMAT;
-            self->conversion.function.linear = linear;
+            babl = babl_calloc (sizeof (BablConversionPixelFormat), 1);
+            babl->class_type = BABL_CONVERSION_PIXEL_FORMAT;
+            babl->conversion.function.linear = linear;
           }
         else if (planar)
           {
-            self = babl_calloc (sizeof (BablConversionPixelFormatPlanar), 1);
-            self->class_type = BABL_CONVERSION_PIXEL_FORMAT_PLANAR;
-            self->conversion.function.planar = planar;
+            babl = babl_calloc (sizeof (BablConversionPixelFormatPlanar), 1);
+            babl->class_type = BABL_CONVERSION_PIXEL_FORMAT_PLANAR;
+            babl->conversion.function.planar = planar;
           }
         else if (planar_bit)
           {
@@ -116,31 +116,31 @@ conversion_new (const char        *name,
       default:
         break;
     }
-  if (!self)
+  if (!babl)
     {
       babl_log ("%s(name='%s', ...): creation failed", __FUNCTION__, name);
       return NULL;
     }
 
-  self->instance.id            = id;
-  self->instance.name          = babl_strdup (name);
-  self->conversion.source      = (union Babl*)source;
-  self->conversion.destination = (union Babl*)destination;
-  self->conversion.time_cost   = time_cost;
-  self->conversion.loss        = loss;
+  babl->instance.id            = id;
+  babl->instance.name          = babl_strdup (name);
+  babl->conversion.source      = (union Babl*)source;
+  babl->conversion.destination = (union Babl*)destination;
+  babl->conversion.time_cost   = time_cost;
+  babl->conversion.loss        = loss;
 
-  babl_add_ptr_to_list ((void ***)&(source->type.from), self);
-  babl_add_ptr_to_list ((void ***)&(destination->type.to), self);
+  babl_add_ptr_to_list ((void ***)&(source->type.from), babl);
+  babl_add_ptr_to_list ((void ***)&(destination->type.to), babl);
   
-  return (BablConversion*)self;
+  return babl;
 }
 
-BablConversion *
+Babl *
 babl_conversion_new (const char *name,
                      ...)
 {
   va_list            varg;
-  BablConversion    *self;
+  Babl              *babl;
 
   int                id          = 0;
   Babl              *source      = NULL;
@@ -226,18 +226,18 @@ babl_conversion_new (const char *name,
   assert (source);
   assert (destination);
 
-  self = conversion_new (name, id,
-                         source, destination, time_cost, loss, linear, planar, planar_bit);
+  babl = conversion_new (name, id, source, destination, time_cost, loss, linear,
+                         planar, planar_bit);
 
-  if ((BablConversion*) db_insert ( (Babl*)self) == self)
+  if (db_insert (babl) == babl)
     {
-      return self;
+      return babl;
     }
   else
     {
-      each_babl_conversion_destroy ( (Babl*)self, NULL);
+      each_babl_conversion_destroy (babl, NULL);
       return NULL;
     }
 }
 
-BABL_CLASS_TEMPLATE(BablConversion, babl_conversion, "BablConversion")
+BABL_CLASS_TEMPLATE (babl_conversion)
index 214fde0a2fae01d3e9e19448646bd695d25e8211..327de7554ba4054819252d5531ab79450df4fc21 100644 (file)
@@ -22,6 +22,6 @@
 
 #include "babl-classes.h"
 
-BABL_DEFINE_CLASS(BablConversion, babl_conversion)
+BABL_DEFINE_CLASS (babl_conversion)
 
 #endif
index d8d4a8ad35851063ba4008109a47d386c5d53f0f..76f9e8d93ada41788ba21d73f0cdb81ec663bf05 100644 (file)
@@ -87,8 +87,8 @@ find_conversion (Babl *babl,
 {
   SearchData *sd     = user_data;
 
-  if ((Babl*)babl->conversion.source      == sd->source &&
-      (Babl*)babl->conversion.destination == sd->destination)
+  if (BABL(babl->conversion.source)      == sd->source &&
+      BABL(babl->conversion.destination) == sd->destination)
     {
       sd->result = (BablConversion*)babl;
       return 1;
@@ -96,26 +96,26 @@ find_conversion (Babl *babl,
   return 0;
 }
 
-BablConversion *babl_conversion_find (Babl *source,
-                                      Babl *destination)
+BablConversion *babl_conversion_find (void *source,
+                                      void *destination)
 {
   SearchData data;
-  data.source      = source;
-  data.destination = destination;
+  data.source      = BABL(source);
+  data.destination = BABL(destination);
   data.result      = NULL;
   babl_conversion_each (find_conversion, &data);
 
   if (!data.result)
     {
       babl_log ("%s('%s', '%s'): failed, aborting", __FUNCTION__,
-        source->instance.name, destination->instance.name);
+        data.source->instance.name, data.destination->instance.name);
       exit (-1);
       return NULL;
     }
   return data.result;
 }
 
-BablFish *
+Babl *
 babl_fish_reference_new (Babl *source,
                          Babl *destination)
 {
@@ -133,31 +133,31 @@ babl_fish_reference_new (Babl *source,
 
   babl->reference_fish.type_to_double =
      babl_conversion_find (
-        (Babl*)source->pixel_format.type[0],
-        (Babl*)babl_type_id (BABL_DOUBLE)
+        source->pixel_format.type[0],
+        babl_type_id (BABL_DOUBLE)
      );
 
   babl->reference_fish.model_to_rgba =
     babl_conversion_find (
-        (Babl*)source->pixel_format.model[0],
-        (Babl*)babl_model_id (BABL_RGBA)
+        source->pixel_format.model[0],
+        babl_model_id (BABL_RGBA)
     );
 
   babl->reference_fish.rgba_to_model =
     babl_conversion_find (
-        (Babl*)babl_model_id (BABL_RGBA),
-        (Babl*)destination->pixel_format.model[0]
+        babl_model_id (BABL_RGBA),
+        destination->pixel_format.model[0]
     );
 
   babl->reference_fish.double_to_type =
     babl_conversion_find (
-        (Babl*)babl_type_id (BABL_DOUBLE),
-        (Babl*)destination->pixel_format.type[0]
+        babl_type_id (BABL_DOUBLE),
+        destination->pixel_format.type[0]
     );
 
   if (db_insert (babl) == babl)
     {
-      return (BablFish*)babl;
+      return babl;
     }
   else
     {
@@ -174,10 +174,10 @@ babl_fish_reference_new (Babl *source,
     babl_add_ptr_to_list ((void ***)&(source->type.from), babl);
     babl_add_ptr_to_list ((void ***)&(destination->type.to), babl);
   */
-  return (BablFish*) babl;
+  return babl;
 }
 
-BablFish *
+Babl *
 babl_fish (Babl *source,
            Babl *destination)
 {
@@ -197,9 +197,9 @@ babl_fish_process (BablFish *babl_fish,
                    int       n)
 {
   Babl *babl;
-  BablImage *imageA;
-  BablImage *imageB;
-  BablImage *imageC;
+  Babl *imageA;
+  Babl *imageB;
+  Babl *imageC;
 
   fooA = babl_malloc(sizeof (double) * n * 4); 
   fooB = babl_malloc(sizeof (double) * n * 4); 
@@ -225,18 +225,17 @@ babl_fish_process (BablFish *babl_fish,
 
   /* calculate planar representation of fooA, and fooB */
 
-  imageA = babl_image_new_from_linear (fooA,
-      (Babl*) ((BablPixelFormat*) babl->fish.source)->model[0]);
-  imageB = babl_image_new_from_linear (fooB, (Babl*)babl_model_id (BABL_RGBA));
+  imageA = babl_image_new_from_linear (fooA, BABL(BABL((babl->fish.source)) -> pixel_format.model[0]));
+  imageB = babl_image_new_from_linear (fooB, babl_model_id (BABL_RGBA));
   /* transform fooA into fooB fooB is rgba double */
 
   ((BablConversion*)(babl->reference_fish.model_to_rgba))->function.planar(
-          imageA->bands, 
-          imageA->data,
-          imageA->pitch,
-          imageB->bands, 
-          imageB->data,
-          imageB->pitch,
+          imageA->image.bands, 
+          imageA->image.data,
+          imageA->image.pitch,
+          imageB->image.bands, 
+          imageB->image.data,
+          imageB->image.pitch,
           n);
   babl_free (imageA);
   babl_free (imageB);
@@ -244,16 +243,16 @@ babl_fish_process (BablFish *babl_fish,
   /* calculate planar representation of fooC */
   /* transform fooB into fooC fooC is ???? double */
 
-  imageB = babl_image_new_from_linear (fooB, (Babl*)babl_model_id (BABL_RGBA));
-  imageC = babl_image_new_from_linear (fooA, (Babl*)((BablPixelFormat*)babl->fish.destination)->model[0]);
+  imageB = babl_image_new_from_linear (fooB, babl_model_id (BABL_RGBA));
+  imageC = babl_image_new_from_linear (fooA, BABL(BABL((babl->fish.destination))->pixel_format.model[0]));
 
   ((BablConversion*)(babl->reference_fish.rgba_to_model))->function.planar(
-          imageB->bands, 
-          imageB->data,
-          imageB->pitch,
-          imageC->bands, 
-          imageC->data,
-          imageC->pitch,
+          imageB->image.bands, 
+          imageB->image.data,
+          imageB->image.pitch,
+          imageC->image.bands, 
+          imageC->image.data,
+          imageC->image.pitch,
           n);
 
 
index 6e1651eae22557f3c205ec47c1122b222b52fefc..087146a971af3519b2941e0932de3b6a29c73af7 100644 (file)
 
 #include "babl-classes.h"
 
-BABL_DEFINE_CLASS_NO_NEW_NO_ID(BablFish, babl_fish)
+BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_fish)
 
-BablFish *
-babl_fish_new (Babl *source,
-               Babl *destination);
-
-BablFish *
+Babl *
 babl_fish (Babl *source,
            Babl *destination);
 
@@ -37,15 +33,15 @@ babl_fish (Babl *source,
  * allowed as well as BablImage objects in their place
  */
 int
-babl_fish_process        (BablFish *babl_fish,
-                          void     *source,
-                          void     *destination,
-                          int       n);
+babl_fish_process        (Babl *babl_fish,
+                          void *source,
+                          void *destination,
+                          int   n);
 
 /* whether the BablFish needs a BablImage to do the processing,
  * or void * are sufficient.
  */
 int
-babl_fish_needs_image (BablFish *babl_dish);
+babl_fish_needs_image (Babl *babl_fish);
 
 #endif
index 83502130319e601120af590386f418b0a4d97fd5..14c60c2b3ddb394240ef8d4f6961c1f00fa5eaf5 100644 (file)
@@ -44,7 +44,7 @@ each_babl_pixel_format_destroy (Babl *babl,
   return 0;  /* continue iterating */
 }
 
-static BablPixelFormat *
+static Babl *
 pixel_format_new (const char     *name,
                   int             id,
                   int             planar,
@@ -54,44 +54,44 @@ pixel_format_new (const char     *name,
                   BablSampling  **sampling,
                   BablType      **type)
 {
-  Babl *self;
+  Babl *babl;
   int              band;
 
-  self                     = babl_calloc (sizeof (BablPixelFormat), 1);
+  babl                     = babl_calloc (sizeof (BablPixelFormat), 1);
 
-  self->class_type    = BABL_PIXEL_FORMAT;
-  self->instance.id   = id;
-  self->instance.name = babl_strdup (name);
+  babl->class_type    = BABL_PIXEL_FORMAT;
+  babl->instance.id   = id;
+  babl->instance.name = babl_strdup (name);
 
-  self->pixel_format.bands    = bands;
-  self->pixel_format.planar   = planar;
+  babl->pixel_format.bands    = bands;
+  babl->pixel_format.planar   = planar;
 
-  self->pixel_format.model     = babl_malloc (sizeof (BablModel*)     * (bands+1));
-  self->pixel_format.component = babl_malloc (sizeof (BablComponent*) * (bands+1));
-  self->pixel_format.type      = babl_malloc (sizeof (BablType*)      * (bands+1));
-  self->pixel_format.sampling  = babl_malloc (sizeof (BablSampling*)  * (bands+1));
+  babl->pixel_format.model     = babl_malloc (sizeof (BablModel*)     * (bands+1));
+  babl->pixel_format.component = babl_malloc (sizeof (BablComponent*) * (bands+1));
+  babl->pixel_format.type      = babl_malloc (sizeof (BablType*)      * (bands+1));
+  babl->pixel_format.sampling  = babl_malloc (sizeof (BablSampling*)  * (bands+1));
 
   for (band=0; band < bands; band++)
     {
-      self->pixel_format.model[band] = model[band];
-      self->pixel_format.component[band] = component[band];
-      self->pixel_format.type[band] = type[band];
-      self->pixel_format.sampling[band] = sampling[band];
+      babl->pixel_format.model[band] = model[band];
+      babl->pixel_format.component[band] = component[band];
+      babl->pixel_format.type[band] = type[band];
+      babl->pixel_format.sampling[band] = sampling[band];
     }
-  self->pixel_format.model[band] = NULL;
-  self->pixel_format.component[band] = NULL;
-  self->pixel_format.type[band]      = NULL;
-  self->pixel_format.sampling[band]  = NULL;
+  babl->pixel_format.model[band] = NULL;
+  babl->pixel_format.component[band] = NULL;
+  babl->pixel_format.type[band]      = NULL;
+  babl->pixel_format.sampling[band]  = NULL;
 
-  return (BablPixelFormat*)self;
+  return babl;
 }
 
-BablPixelFormat *
+Babl *
 babl_pixel_format_new (const char *name,
                        ...)
 {
   va_list varg;
-  BablPixelFormat *self;
+  Babl            *babl;
   int              id     = 0;
   int              planar = 0;
   int              bands  = 0;
@@ -100,8 +100,8 @@ babl_pixel_format_new (const char *name,
   BablSampling    *sampling  [BABL_MAX_BANDS];
   BablType        *type      [BABL_MAX_BANDS];
 
-  BablSampling    *current_sampling = babl_sampling (1,1);
-  BablType        *current_type     = babl_type_id (BABL_U8);
+  BablSampling    *current_sampling = (BablSampling*) babl_sampling (1,1);
+  BablType        *current_type     = (BablType*)     babl_type_id (BABL_U8);
   BablModel       *current_model    = NULL;
   const char      *arg              = name;
 
@@ -193,21 +193,21 @@ babl_pixel_format_new (const char *name,
   va_end   (varg);
 
 
-  self = pixel_format_new (name, id,
+  babl = pixel_format_new (name, id,
                            planar,
                            bands,
                            model, component, sampling, type);
 
   
-  if ((BablPixelFormat*) db_insert ((Babl*)self) == self)
+  if (db_insert (babl) == babl)
     {
-      return self;
+      return babl;
     }
   else
     {
-      each_babl_pixel_format_destroy ((Babl*)self, NULL);
+      each_babl_pixel_format_destroy (babl, NULL);
       return NULL;
     }
 }
 
-BABL_CLASS_TEMPLATE (BablPixelFormat, babl_pixel_format, "BablPixelFormat")
+BABL_CLASS_TEMPLATE (babl_pixel_format)
index a9d797738a32cff525d9cc83dc8c4d3b12d7993a..b43d9c46dfae793d5cbfe9d5e74bcca6bf81585b 100644 (file)
@@ -21,6 +21,6 @@
 #define _BABL_PIXEL_FORMAT_H
 
 #include "babl-classes.h"
-BABL_DEFINE_CLASS(BablPixelFormat, babl_pixel_format)
+BABL_DEFINE_CLASS (babl_pixel_format)
 
 #endif
index 48f470d78ef06d1f5f1389a8e796da525061ddeb..8dc132daca4b9f7096970619847e9f692ca97430 100644 (file)
@@ -40,55 +40,55 @@ each_babl_image_destroy (Babl *babl,
 }
 #endif
 
-static BablImage *
+static Babl *
 image_new (int             bands,
            BablComponent **component,
            void          **data,
            int            *pitch,
            int            *stride)
 {
-  Babl *self;
+  Babl *babl;
   int        band;
 
-  self                = babl_calloc (
+  babl                = babl_calloc (
                            sizeof (BablImage) +
                            sizeof (BablComponent*) * (bands+1) +
                            sizeof (void*)          * (bands+1) +
                            sizeof (int)            * (bands+1) +
                            sizeof (int)            * (bands+1),1);
 
-  self->image.component     = ((void *)self)                  + sizeof (BablImage);
-  self->image.data          = ((void *)self->image.component) + sizeof (BablComponent*) * (bands+1);
-  self->image.pitch         = ((void *)self->image.data)      + sizeof (void*)          * (bands+1);
-  self->image.stride        = ((void *)self->image.pitch)     + sizeof (int)            * (bands+1);
-/*self->image.foo           = ((void *)self->image.stride)    + sizeof (int)            * (bands+1);*/
+  babl->image.component     = ((void *)babl)                  + sizeof (BablImage);
+  babl->image.data          = ((void *)babl->image.component) + sizeof (BablComponent*) * (bands+1);
+  babl->image.pitch         = ((void *)babl->image.data)      + sizeof (void*)          * (bands+1);
+  babl->image.stride        = ((void *)babl->image.pitch)     + sizeof (int)            * (bands+1);
+/*babl->image.foo           = ((void *)babl->image.stride)    + sizeof (int)            * (bands+1);*/
 
-  self->class_type    = BABL_IMAGE;
-  self->instance.id   = 0;
-  self->instance.name = "babl image";
+  babl->class_type    = BABL_IMAGE;
+  babl->instance.id   = 0;
+  babl->instance.name = "babl image";
 
-  self->image.bands         = bands;
+  babl->image.bands         = bands;
 
   for (band=0; band < bands; band++)
     {
-      self->image.component[band] = component[band];
-      self->image.data[band]      = data[band];
-      self->image.pitch[band]     = pitch[band];
-      self->image.stride[band]    = stride[band];
+      babl->image.component[band] = component[band];
+      babl->image.data[band]      = data[band];
+      babl->image.pitch[band]     = pitch[band];
+      babl->image.stride[band]    = stride[band];
     }
-  self->image.component[band] = NULL;
-  self->image.data[band]      = NULL;
-  self->image.pitch[band]     = 0;
-  self->image.stride[band]    = 0;
+  babl->image.component[band] = NULL;
+  babl->image.data[band]      = NULL;
+  babl->image.pitch[band]     = 0;
+  babl->image.stride[band]    = 0;
 
-  return (BablImage*) self;
+  return babl;
 }
 
-BablImage *
+Babl *
 babl_image_new_from_linear (void  *buffer,
-                            Babl  *babl)
+                            Babl  *format)
 {
-  BablImage     *self;
+  Babl          *babl;
   int            band;
   BablComponent *component [BABL_MAX_BANDS];
   void          *data      [BABL_MAX_BANDS];
@@ -98,20 +98,20 @@ babl_image_new_from_linear (void  *buffer,
   int            offset=0;
   int            calc_pitch=0;
  
-  switch (babl->class_type)
+  switch (format->class_type)
     {
       case BABL_PIXEL_FORMAT:
-        for (band=0; band < babl->pixel_format.bands; band++)
+        for (band=0; band < format->pixel_format.bands; band++)
           {
-            BablType *type = babl->pixel_format.type[band];
+            BablType *type = format->pixel_format.type[band];
             calc_pitch += (type->bits / 8);
           }
 
-        for (band=0; band < babl->pixel_format.bands; band++)
+        for (band=0; band < format->pixel_format.bands; band++)
           {
-            BablType *type = babl->pixel_format.type[band];
+            BablType *type = format->pixel_format.type[band];
 
-            component[band] = babl->pixel_format.component[band];
+            component[band] = format->pixel_format.component[band];
             data[band]      = buffer + offset;
             pitch[band]     = calc_pitch;
             stride[band]    = 0;
@@ -120,14 +120,14 @@ babl_image_new_from_linear (void  *buffer,
           }
         break;
       case BABL_MODEL:
-        for (band=0; band < babl->model.components; band++)
+        for (band=0; band < format->model.components; band++)
           {
             calc_pitch += (64 / 8);
           }
 
-        for (band=0; band < babl->model.components; band++)
+        for (band=0; band < format->model.components; band++)
           {
-            component[band] = babl->model.component[band];
+            component[band] = format->model.component[band];
             data[band]      = buffer + offset;
             pitch[band]     = calc_pitch;
             stride[band]    = 0;
@@ -140,16 +140,16 @@ babl_image_new_from_linear (void  *buffer,
         break;
     }
 
-  self = image_new (babl->model.components, component, data, pitch, stride);
-  return self;
+  babl = image_new (format->model.components, component, data, pitch, stride);
+  return babl;
 }
 
-BablImage *
+Babl *
 babl_image_new (void *first,
                 ...)
 {
   va_list        varg;
-  BablImage      *self;
+  Babl           *babl;
   int            bands     = 0;
   BablComponent *component [BABL_MAX_BANDS];
   void          *data      [BABL_MAX_BANDS];
@@ -183,7 +183,7 @@ babl_image_new (void *first,
         }
       else
         {
-          new_component = babl_component (arg);
+          new_component = (BablComponent*)babl_component (arg);
         }
 
       component [bands] = new_component;
@@ -204,9 +204,9 @@ babl_image_new (void *first,
   va_end   (varg);
 
 
-  self = image_new (bands, component, data, pitch, stride);
+  babl = image_new (bands, component, data, pitch, stride);
 
-  return self;
+  return babl;
 }
 
 void
index 50b351cfc4ad3cef1ebc8529553492679b77955e..fc33e0e3773522f94a2c8bb96e0749c17790588a 100644 (file)
 
 #include "babl-classes.h"
 
-void        babl_image_init       (void);
-void        babl_image_introspect (void);
-void        babl_image_each       (BablEachFunction  each_fun,
-                                   void             *user_data);
-void        babl_image_destroy    (void);    
-BablImage * babl_image_new        (void *first_component,
+void   babl_image_init       (void);
+void   babl_image_introspect (void);
+void   babl_image_each       (BablEachFunction  each_fun,
+                              void             *user_data);
+void   babl_image_destroy    (void);    
+Babl * babl_image_new        (void *first_component,
                                    ...);
 
-/* create a new BablImage based on a packed BablPixelFormat (or BablModel assumed to
- * use only doubles).
+/* create a new BablImage based on a packed BablPixelFormat (or BablModel which
+ * is a virtual pixelformat based on the BablModel using only doubles in the
+ * order they are listed in the model.
  */
-BablImage *
+Babl *
 babl_image_new_from_linear (void *buffer,
                             Babl *format);
 #endif
index 3869787724067e5289592e0483f7e923682fdd9a..cfd7ff262e38268e2b51e951f664d1872c646806 100644 (file)
@@ -11,21 +11,21 @@ const char  *babl_class_name     (BablClassType klass);
  * headers to a minimum, only the ones overriding the basic api with
  * custom ways of construction.
  */
-#define BABL_DEFINE_CLASS(TypeName, type_name)                   \
+#define BABL_DEFINE_CLASS(type_name)                             \
                                                                  \
-void       type_name##_init       (void);                        \
-void       type_name##_destroy    (void);                        \
-void       type_name##_each       (BablEachFunction  each_fun,   \
-                                   void             *user_data); \
-TypeName * type_name              (const char       *name);      \
-TypeName * type_name##_id         (int               id);        \
-TypeName * type_name##_new        (const char       *name,       \
-                                   ...);
-#define BABL_DEFINE_CLASS_NO_NEW_NO_ID(TypeName, type_name)      \
+void   type_name##_init    (void);                        \
+void   type_name##_destroy (void);                        \
+void   type_name##_each    (BablEachFunction  each_fun,   \
+                            void             *user_data); \
+Babl * type_name           (const char       *name);      \
+Babl * type_name##_id      (int               id);        \
+Babl * type_name##_new     (const char       *name,       \
+                            ...);
+#define BABL_DEFINE_CLASS_NO_NEW_NO_ID(type_name)                \
                                                                  \
-void       type_name##_init       (void);                        \
-void       type_name##_destroy    (void);                        \
-void       type_name##_each       (BablEachFunction  each_fun,   \
-                                   void             *user_data);
+void   type_name##_init    (void);                        \
+void   type_name##_destroy (void);                        \
+void   type_name##_each    (BablEachFunction  each_fun,   \
+                            void             *user_data);
 
 #endif
index 5426de1954c8aee53dafddfcfadeb1a75c591554..64b2b001e430203ef957dbae6ea0bb0e87eba14c 100644 (file)
@@ -47,30 +47,30 @@ type_name##_each (BablEachFunction  each_fun,                 \
   db_each (each_fun, user_data);                              \
 }                                                             \
 
-#define BABL_DEFINE_LOOKUP_BY_ID(TypeName, type_name)         \
-TypeName *                                                    \
+#define BABL_DEFINE_LOOKUP_BY_ID(type_name)                   \
+Babl *                                                        \
 type_name##_id (int id)                                       \
 {                                                             \
-  return (TypeName*) db_exist (id, NULL);                     \
+  return db_exist (id, NULL);                                 \
 }
 
-#define BABL_DEFINE_LOOKUP_BY_NAME(TypeName, type_name)       \
-TypeName *                                                    \
+#define BABL_DEFINE_LOOKUP_BY_NAME(type_name)                 \
+Babl *                                                        \
 type_name (const char *name)                                  \
 {                                                             \
-  TypeName *ret;                                              \
+  Babl *babl;                                                 \
                                                               \
   if (babl_hmpf_on_name_lookups)                              \
     {                                                         \
       babl_log ("%s(\"%s\"): hmpf!", __FUNCTION__, name);     \
     }                                                         \
-  ret = (TypeName*) db_exist (0, name);                       \
+  babl = db_exist (0, name);                                  \
                                                               \
-  if (!ret)                                                   \
+  if (!babl)                                                  \
     {                                                         \
       babl_log ("%s(\"%s\"): not found", __FUNCTION__, name); \
     }                                                         \
-  return ret;                                                 \
+  return babl;                                                \
 }
 
 #define BABL_DEFINE_INIT(type_name)                           \
@@ -88,12 +88,13 @@ type_name##_destroy (void)                                    \
   db_destroy ();                                              \
 }
 
-#define BABL_CLASS_TEMPLATE(TypeName, type_name, type_string) \
+#define BABL_CLASS_TEMPLATE(type_name)                        \
 BABL_DEFINE_INIT           (type_name)                        \
 BABL_DEFINE_DESTROY        (type_name)                        \
-BABL_DEFINE_LOOKUP_BY_NAME (TypeName, type_name)              \
+BABL_DEFINE_LOOKUP_BY_NAME (type_name)                        \
 BABL_DEFINE_EACH           (type_name)                        \
-BABL_DEFINE_LOOKUP_BY_ID   (TypeName, type_name)               
+BABL_DEFINE_LOOKUP_BY_ID   (type_name)               
 
+#define BABL(obj)  ((Babl*)(obj))
 
 #endif
index 6ab5b28809886548239e21eff9fc110c6db3441a..36b35fd9b62e26941734b08a1b4f298ac9de5f3d 100644 (file)
@@ -113,7 +113,7 @@ model_introspect (Babl *babl)
   for (i=0; i< babl->model.components; i++)
     {
       babl_log ("\t\tindex[%i] = '%s'",
-                i, ((Babl*)babl->model.component[i])->instance.name  );
+                i, BABL(babl->model.component[i])->instance.name  );
     }
 }
 
@@ -144,8 +144,8 @@ pixel_format_introspect (Babl *babl)
   for (i=0; i< babl->pixel_format.bands; i++)
     {
       babl_log ("\t\tband[%i] type='%s' component='%s'",
-                i,  ( (Babl*)(babl->pixel_format.type[i]     ))->instance.name,
-                    ( (Babl*)(babl->pixel_format.component[i]))->instance.name);
+                i,  ( BABL(babl->pixel_format.type[i]     ))->instance.name,
+                    ( BABL(babl->pixel_format.component[i]))->instance.name);
     }
 }
 
index c95740929b6cdd7fc2f5cd78b647542af5aff497..0218090cb91d4bec8c35459400e6e2c1b2ab04b0 100644 (file)
@@ -38,42 +38,42 @@ each_babl_model_destroy (Babl *babl,
 
 #define BABL_MAX_COMPONENTS 32
 
-static BablModel *
+static Babl *
 model_new (const char     *name,
            int             id,
            int             components,
            BablComponent **component)
 {
-  Babl *self;
+  Babl *babl;
   int   i; 
 
-  self                     = babl_calloc (sizeof (BablModel), 1);
+  babl                     = babl_calloc (sizeof (BablModel), 1);
 
-  self->class_type       = BABL_MODEL;
-  self->instance.id      = id;
-  self->instance.name    = babl_strdup (name);
-  self->model.components = components;
-  self->model.component  = babl_malloc (sizeof (BablComponent*) * (components+1));
+  babl->class_type       = BABL_MODEL;
+  babl->instance.id      = id;
+  babl->instance.name    = babl_strdup (name);
+  babl->model.components = components;
+  babl->model.component  = babl_malloc (sizeof (BablComponent*) * (components+1));
 
   for (i=0; i < components; i++)
     {
-      self->model.component[i] = component[i];
+      babl->model.component[i] = component[i];
     }
-  self->model.component[i] = NULL;
+  babl->model.component[i] = NULL;
 
-  return (BablModel*)self;
+  return babl;
 }
 
-BablModel *
+Babl *
 babl_model_new (const char *name,
                        ...)
 {
-  va_list varg;
-  BablModel *self;
-  int              id     = 0;
-  int              components  = 0;
-  BablComponent   *band_component [BABL_MAX_COMPONENTS];
-  const char      *arg=name;
+  va_list        varg;
+  Babl          *babl;
+  int            id     = 0;
+  int            components  = 0;
+  BablComponent *band_component [BABL_MAX_COMPONENTS];
+  const char    *arg=name;
 
   va_start (varg, name);
 
@@ -142,17 +142,17 @@ babl_model_new (const char *name,
     
   va_end   (varg);
 
-  self = model_new (name, id, components, band_component);
+  babl = model_new (name, id, components, band_component);
   
-  if ((BablModel*) db_insert ((Babl*)self) == self)
+  if (db_insert (babl) == babl)
     {
-      return self;
+      return babl;
     }
   else
     {
-      each_babl_model_destroy ((Babl*)self, NULL);
+      each_babl_model_destroy (babl, NULL);
       return NULL;
     }
 }
 
-BABL_CLASS_TEMPLATE (BablModel, babl_model, "BablModel")
+BABL_CLASS_TEMPLATE (babl_model)
index 31121ea756077b9703dc2b12cf49e50ae1bc6c24..d31cbe5c019d0bfa1105fa8527b10c503102296e 100644 (file)
@@ -21,6 +21,6 @@
 #define _BABL_pixel_format_H
 
 #include "babl-classes.h"
-BABL_DEFINE_CLASS(BablModel, babl_model)
+BABL_DEFINE_CLASS (babl_model)
 
 #endif
index 83502130319e601120af590386f418b0a4d97fd5..14c60c2b3ddb394240ef8d4f6961c1f00fa5eaf5 100644 (file)
@@ -44,7 +44,7 @@ each_babl_pixel_format_destroy (Babl *babl,
   return 0;  /* continue iterating */
 }
 
-static BablPixelFormat *
+static Babl *
 pixel_format_new (const char     *name,
                   int             id,
                   int             planar,
@@ -54,44 +54,44 @@ pixel_format_new (const char     *name,
                   BablSampling  **sampling,
                   BablType      **type)
 {
-  Babl *self;
+  Babl *babl;
   int              band;
 
-  self                     = babl_calloc (sizeof (BablPixelFormat), 1);
+  babl                     = babl_calloc (sizeof (BablPixelFormat), 1);
 
-  self->class_type    = BABL_PIXEL_FORMAT;
-  self->instance.id   = id;
-  self->instance.name = babl_strdup (name);
+  babl->class_type    = BABL_PIXEL_FORMAT;
+  babl->instance.id   = id;
+  babl->instance.name = babl_strdup (name);
 
-  self->pixel_format.bands    = bands;
-  self->pixel_format.planar   = planar;
+  babl->pixel_format.bands    = bands;
+  babl->pixel_format.planar   = planar;
 
-  self->pixel_format.model     = babl_malloc (sizeof (BablModel*)     * (bands+1));
-  self->pixel_format.component = babl_malloc (sizeof (BablComponent*) * (bands+1));
-  self->pixel_format.type      = babl_malloc (sizeof (BablType*)      * (bands+1));
-  self->pixel_format.sampling  = babl_malloc (sizeof (BablSampling*)  * (bands+1));
+  babl->pixel_format.model     = babl_malloc (sizeof (BablModel*)     * (bands+1));
+  babl->pixel_format.component = babl_malloc (sizeof (BablComponent*) * (bands+1));
+  babl->pixel_format.type      = babl_malloc (sizeof (BablType*)      * (bands+1));
+  babl->pixel_format.sampling  = babl_malloc (sizeof (BablSampling*)  * (bands+1));
 
   for (band=0; band < bands; band++)
     {
-      self->pixel_format.model[band] = model[band];
-      self->pixel_format.component[band] = component[band];
-      self->pixel_format.type[band] = type[band];
-      self->pixel_format.sampling[band] = sampling[band];
+      babl->pixel_format.model[band] = model[band];
+      babl->pixel_format.component[band] = component[band];
+      babl->pixel_format.type[band] = type[band];
+      babl->pixel_format.sampling[band] = sampling[band];
     }
-  self->pixel_format.model[band] = NULL;
-  self->pixel_format.component[band] = NULL;
-  self->pixel_format.type[band]      = NULL;
-  self->pixel_format.sampling[band]  = NULL;
+  babl->pixel_format.model[band] = NULL;
+  babl->pixel_format.component[band] = NULL;
+  babl->pixel_format.type[band]      = NULL;
+  babl->pixel_format.sampling[band]  = NULL;
 
-  return (BablPixelFormat*)self;
+  return babl;
 }
 
-BablPixelFormat *
+Babl *
 babl_pixel_format_new (const char *name,
                        ...)
 {
   va_list varg;
-  BablPixelFormat *self;
+  Babl            *babl;
   int              id     = 0;
   int              planar = 0;
   int              bands  = 0;
@@ -100,8 +100,8 @@ babl_pixel_format_new (const char *name,
   BablSampling    *sampling  [BABL_MAX_BANDS];
   BablType        *type      [BABL_MAX_BANDS];
 
-  BablSampling    *current_sampling = babl_sampling (1,1);
-  BablType        *current_type     = babl_type_id (BABL_U8);
+  BablSampling    *current_sampling = (BablSampling*) babl_sampling (1,1);
+  BablType        *current_type     = (BablType*)     babl_type_id (BABL_U8);
   BablModel       *current_model    = NULL;
   const char      *arg              = name;
 
@@ -193,21 +193,21 @@ babl_pixel_format_new (const char *name,
   va_end   (varg);
 
 
-  self = pixel_format_new (name, id,
+  babl = pixel_format_new (name, id,
                            planar,
                            bands,
                            model, component, sampling, type);
 
   
-  if ((BablPixelFormat*) db_insert ((Babl*)self) == self)
+  if (db_insert (babl) == babl)
     {
-      return self;
+      return babl;
     }
   else
     {
-      each_babl_pixel_format_destroy ((Babl*)self, NULL);
+      each_babl_pixel_format_destroy (babl, NULL);
       return NULL;
     }
 }
 
-BABL_CLASS_TEMPLATE (BablPixelFormat, babl_pixel_format, "BablPixelFormat")
+BABL_CLASS_TEMPLATE (babl_pixel_format)
index a9d797738a32cff525d9cc83dc8c4d3b12d7993a..b43d9c46dfae793d5cbfe9d5e74bcca6bf81585b 100644 (file)
@@ -21,6 +21,6 @@
 #define _BABL_PIXEL_FORMAT_H
 
 #include "babl-classes.h"
-BABL_DEFINE_CLASS(BablPixelFormat, babl_pixel_format)
+BABL_DEFINE_CLASS (babl_pixel_format)
 
 #endif
index 7bd2f86d0afba3e24101e1bae5304eba09631a06..a5e813d925fd7e45563b8f0e8dc539a6a798ebf5 100644 (file)
@@ -63,7 +63,7 @@ babl_sampling_each (BablEachFunction  each_fun,
     for (vertical=VERTICAL_MIN; vertical<=VERTICAL_MAX; vertical++)
       {
        int index= (vertical-VERTICAL_MIN) * VERTICAL_MAX + (horizontal - HORIZONTAL_MIN);
-       if (each_fun ((Babl*) &(db[index]), user_data))
+       if (each_fun (BABL (&db[index]), user_data))
          return;
       }
 }
index 5304c3f89cbe314ac24e1a6085b83db9f4725ce5..6bc917ba8b4fb273d0e349607f13e9615b76014d 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "babl-classes.h"
 
-BABL_DEFINE_CLASS_NO_NEW_NO_ID(BablSampling, babl_sampling)
-BablSampling * babl_sampling            (int horizontal,
-                                         int vertical);
+BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_sampling)
+Babl * babl_sampling (int horizontal,
+                      int vertical);
 #endif
index db58dc8f0d4d9f90fca58525f7e8cfbc2c9bb943..271f84eaa150248bfbe0a17e607e371cd8f84c4c 100644 (file)
@@ -47,7 +47,7 @@ type_sanity (Babl *babl,
 
       while (ptr && NULL!=*ptr)
         {
-          if (babl_conversion_destination ((Babl *)(*ptr)) == (Babl*)babl_type_id (BABL_DOUBLE))
+          if (babl_conversion_destination ((Babl *)(*ptr)) == babl_type_id (BABL_DOUBLE))
             {
               ok = 1;
               break;
@@ -67,7 +67,7 @@ type_sanity (Babl *babl,
 
       while (ptr && NULL!=*ptr)
         {
-          if (babl_conversion_source ((Babl *)(*ptr)) == (Babl*)babl_type_id (BABL_DOUBLE))
+          if (babl_conversion_source ((Babl *)(*ptr)) == babl_type_id (BABL_DOUBLE))
             {
               ok = 1;
               break;
@@ -99,7 +99,7 @@ model_sanity (Babl *babl,
 
       while (ptr && NULL!=*ptr)
         {
-          if (babl_conversion_destination ((Babl *)(*ptr)) == (Babl*)babl_model_id (BABL_RGBA))
+          if (babl_conversion_destination ((Babl *)(*ptr)) == babl_model_id (BABL_RGBA))
             {
               ok = 1;
               break;
@@ -119,7 +119,7 @@ model_sanity (Babl *babl,
 
       while (ptr && NULL!=*ptr)
         {
-          if (babl_conversion_source ((Babl *)(*ptr)) == (Babl*)babl_model_id (BABL_RGBA))
+          if (babl_conversion_source ((Babl *)(*ptr)) == babl_model_id (BABL_RGBA))
             {
               ok = 1;
               break;
index 4db95bddbc1ade1d53a222484bc451ee3401c9ff..15ec8511e07fbdca32964e9419977a74daa9d80a 100644 (file)
@@ -37,33 +37,33 @@ each_babl_type_destroy (Babl *babl,
 }
 
 
-static BablType *
+static Babl *
 type_new (const char  *name,
           int          id,
           int          bits)
 {
-  Babl *self;
+  Babl *babl;
 
   assert (bits != 0);
   assert (bits % 8 == 0);
   
-  self                = babl_calloc (sizeof (BablType), 1);
-  self->class_type    = BABL_TYPE;
-  self->instance.id   = id;
-  self->instance.name = babl_strdup (name);
-  self->type.bits     = bits;
+  babl                = babl_calloc (sizeof (BablType), 1);
+  babl->class_type    = BABL_TYPE;
+  babl->instance.id   = id;
+  babl->instance.name = babl_strdup (name);
+  babl->type.bits     = bits;
 
-  return (BablType*)self;
+  return babl;
 }
 
-BablType *
+Babl *
 babl_type_new (const char *name,
                ...)
 {
-  va_list      varg;
-  BablType    *self;
-  int          id          = 0;
-  int          bits        = 0;
+  va_list  varg;
+  Babl    *babl;
+  int      id    = 0;
+  int      bits  = 0;
 
   const char *arg=name;
 
@@ -103,17 +103,17 @@ babl_type_new (const char *name,
     
   va_end   (varg);
 
-  self = type_new (name, id, bits);
+  babl = type_new (name, id, bits);
 
-  if ((BablType*) db_insert ((Babl*)self) == self)
+  if (db_insert (babl) == babl)
     {
-      return self;
+      return babl;
     }
   else
     {
-      each_babl_type_destroy ((Babl*)self, NULL);
+      each_babl_type_destroy (babl, NULL);
       return NULL;
     }
 }
 
-BABL_CLASS_TEMPLATE (BablType, babl_type, "BablType")
+BABL_CLASS_TEMPLATE (babl_type)
index 6b05fe83742bd03b243b1b85241c8d83ff69d245..f4417e3768f7ce39ae0b5a1d8fab571584a317c1 100644 (file)
@@ -21,6 +21,6 @@
 #define _BABL_TYPE_H
 
 #include "babl-classes.h"
-BABL_DEFINE_CLASS(BablType, babl_type)
+BABL_DEFINE_CLASS (babl_type)
 
 #endif
index 5f392e22f2c4ad012b2f96dc44c51f94c2b42ae4..86b9e4ddb0bb7e66aaf8d569ef9aaaab020a73a6 100644 (file)
@@ -46,20 +46,20 @@ unsigned char u8_ref_buf [BUFFER_LENGTH]=
 int
 test_float_to_rgb_u8 (void)
 {
-  BablFish *fish;
-  int       i;
-  int      OK=1;
+  Babl *fish;
+  int   i;
+  int   OK=1;
 
   
   fish = babl_fish (
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "foo",
       babl_model ("grayscale"),
       babl_type ("float"),
       babl_component ("luminance"),
       NULL
     ),
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "bar",
       babl_model ("grayscale"),
       babl_type ("u8"),
index deb9cacbb88f3c2b7665c968c64879abd0906869..367689d8376eefb5a56f5ee10111bd5038ab9457 100644 (file)
@@ -32,20 +32,20 @@ float rgb_buf     [PIXELS*3];
 int
 test (void)
 {
-  BablFish *fish;
-  int       i;
-  int      OK=1;
+  Babl *fish;
+  int   i;
+  int   OK=1;
 
   
   fish = babl_fish (
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "foo",
       babl_model ("grayscale"),
       babl_type ("float"),
       babl_component ("luminance"),
       NULL
     ),
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "bar",
       babl_model ("rgb"),
       babl_type ("float"),
index 063a9fe03e6d9d6b34cb12d319af5bc6b96daf85..cf4c87079f8cd8315b8a0f593556cecfcebb0319 100644 (file)
@@ -39,13 +39,13 @@ float destination_buf [PIXELS*3];
 int
 test (void)
 {
-  BablFish *fish;
-  int       i;
-  int      OK=1;
+  Babl *fish;
+  int   i;
+  int   OK=1;
 
   
   fish = babl_fish (
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "foo",
       babl_model ("rgb"),
       babl_type ("float"),
@@ -54,7 +54,7 @@ test (void)
       babl_component ("blue"),
       NULL
     ),
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "bar",
       babl_model ("CIE Lab"),
       babl_type ("float"), 
@@ -67,8 +67,8 @@ test (void)
 
   babl_fish_process (fish, source_buf, temp_buf, PIXELS);
 
-  fish = babl_fish ((Babl*) babl_pixel_format ("bar"),
-                    (Babl*) babl_pixel_format ("foo"));
+  fish = babl_fish (babl_pixel_format ("bar"),
+                    babl_pixel_format ("foo"));
   
   babl_fish_process (fish, temp_buf, destination_buf, PIXELS);
 
index a406457da4400346215761b34a98850c15287ed4..8462067e6e9c85863dd110b92d122a5884be4a22 100644 (file)
@@ -47,13 +47,12 @@ float destination_buf [PIXELS*3];
 int
 test (void)
 {
-  BablFish *fish;
-  int       i;
-  int      OK=1;
-
+  Babl *fish;
+  int   i;
+  int   OK=1;
   
   fish = babl_fish (
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "foo",
       babl_model ("rgb"),
       babl_type ("float"),
@@ -62,7 +61,7 @@ test (void)
       babl_component ("blue"),
       NULL
     ),
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "bar",
       babl_model ("ycbcr"),
       babl_type ("float"),
index e9a0d1da51d94aed43a513bbba8de1bd6e562e97..4b324d2080ac0fee258583b0a2c0902671733ee9 100644 (file)
@@ -39,13 +39,12 @@ float destination_buf [PIXELS*3];
 int
 test (void)
 {
-  BablFish *fish;
-  int       i;
-  int      OK=1;
-
+  Babl *fish;
+  int   i;
+  int   OK=1;
   
   fish = babl_fish (
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "foo",
       babl_model ("rgb"),
       babl_type ("float"),
@@ -54,7 +53,7 @@ test (void)
       babl_component ("blue"),
       NULL
     ),
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "bar",
       babl_model ("ycbcr"),
       babl_type ("float"), 
@@ -67,8 +66,8 @@ test (void)
 
   babl_fish_process (fish, source_buf, temp_buf, PIXELS);
 
-  fish = babl_fish ((Babl*) babl_pixel_format ("bar"),
-                    (Babl*) babl_pixel_format ("foo"));
+  fish = babl_fish (babl_pixel_format ("bar"),
+                    babl_pixel_format ("foo"));
   
   babl_fish_process (fish, temp_buf, destination_buf, PIXELS);
 
index ca77219b3d7a4ffa77954bb08afd155d79ead63e..e22102121666fab16e73cea82a38a0b21c10239f 100644 (file)
@@ -31,20 +31,20 @@ float float_buf [BUFFER_LENGTH];
 int
 test (void)
 {
-  BablFish *fish;
-  int       i;
-  int      OK=1;
+  Babl *fish;
+  int   i;
+  int   OK=1;
 
   
   fish = babl_fish (
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "foo",
       babl_model ("grayscale"),
       babl_type ("u8"),
       babl_component ("luminance"),
       NULL
     ),
-    (Babl*) babl_pixel_format_new (
+    babl_pixel_format_new (
       "bar",
       babl_model ("grayscale"),
       babl_type ("float"),